package Tasks;

import AI.AiEntity;
import Items.Item;
import Main.SpaceGame;

public class PickUpItem extends Task
{
	Item item;
	SpaceGame main;
	
	public PickUpItem(Item i, SpaceGame main)
	{
		currentStep = 0;
		urgency = 1;
		this.item = i;
		this.main = main;
		stepList.add(new Movement(i.x, i.y));
	}

	@Override
	public void performTask(AiEntity e) 
	{
		if(stepList.get(currentStep).isFinished(e))
			currentStep++;
		if(currentStep < stepList.size())
		{
			stepList.get(currentStep).performTask(e);
		}
		else
		{
			e.pickUpItem(item);
			finished = true;
		}
	}

	@Override
	public boolean isFinished(AiEntity e) 
	{
		return finished;
	}
}
